package com.huyn.baseframework.utils;

import com.huyn.baseframework.ImageSizeDefineUtil;

public class ImageParamUtils {

    public static String getImgUrl(String url, int w, int h) {
        return ImageSizeDefineUtil.getImgUrl(url, w, h);
    }

    public static String getImgUrl(int w, int h) {
        return ImageSizeDefineUtil.getImgUrl(w, h);
    }

    public static String getScaledImgUrl(String url, int w, int h, int max) {
        if (!url.contains("aube-tv"))
            return url;
        return url + getScaledImgUrl(w, h, max);
    }

    public static String getScaledImgUrl(int w, int h, int max) {
        if (w == 0 || h == 0)
            return getImgUrl(max, max);
        if (w > h) {
            return getImgUrl(max, (int) (max * h * 1f / w));
        } else {
            return getImgUrl((int) (max * w * 1f / h), max);
        }
    }

    /**
     * @param w
     * @param h
     * @param radius
     * @param sigma
     * @return @100w_100h_1e_1c_3-2bl
     */
    public static String getImgUrl(int w, int h, int radius, int sigma) {
        return ImageSizeDefineUtil.getImgUrl(w, h, radius, sigma);
    }

    public static String getImgUrl(String url, int w, int h, int radius, int sigma) {
        return ImageSizeDefineUtil.getImgUrl(url, w, h, radius, sigma);
    }

    public static String getSquareUrl(String url, int width, int height) {
        return ImageSizeDefineUtil.getSquareUrl(url, width, height);
    }

    public static String getPicList(String url) {
        return ImageSizeDefineUtil.getPicList(url);
    }

    public static String getGalleryPicArg(String url) {
        return ImageSizeDefineUtil.getGalleryPicArg(url);
    }

    public static String getGalleryPicArg() {
        if(SysUtil.isXXLargeScreen(null)) {
            return getImgUrl(600, 600);
        } else {
            return getImgUrl(400, 400);
        }
    }

    public static String appendHeaderLogo(String url) {
        return ImageSizeDefineUtil.appendHeaderLogo(url);
    }

}
